Skip to content

wayland/drm_syncobj: Allow temporarily close the device#2025

Open
Drakulix wants to merge 1 commit into
masterfrom
feat/drm-sync-close
Open

wayland/drm_syncobj: Allow temporarily close the device#2025
Drakulix wants to merge 1 commit into
masterfrom
feat/drm-sync-close

Conversation

@Drakulix
Copy link
Copy Markdown
Member

@Drakulix Drakulix commented May 7, 2026

libseat recommends to re-open file descriptors after suspend/resume, since they might have been permanently revoked.

Unfortunately it doesn't wire-up logind's resume event, which provides new file descriptors, to pass those on. As a result compositors need to issue a new open-call, which will not succeed unless the old file descriptor has been closed.

Since we put the DrmDeviceFd into internal Arcs (yes multiple), this can be a bit annoying and one part where we completely fail to provide a way to re-open the FD is our drm_syncobj-protocol implementation.

You can update the internal device in case it disappears and you want to select a new one. But if you simply want to re-open the file descriptor, there is no way to do that without invalidating all existing timelines in the process (which is obviously bad and will hang some clients due to unsignaled release points).

There isn't really an elegant way to do this, so this PR provides a way to temporarily close the internal file descriptor of the global's state.

Description

Checklist

Comment thread src/wayland/drm_syncobj/mod.rs Outdated
Comment on lines +165 to +166
/// Note: Any existing timeline objects will error out and hang clients,
/// until `update_device` is called with a new device fd.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if we use post_error, that won't just hang the client, it will cause the client to crash when its Wayland connection is broken by the protocol error, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For new timelines this is correct, but for old timelines signal and similar will be noops.

@Drakulix Drakulix force-pushed the feat/drm-sync-close branch from 3d275ad to f2a3bc7 Compare May 12, 2026 16:08
@Drakulix Drakulix requested a review from ids1024 May 12, 2026 16:09
@Drakulix Drakulix force-pushed the feat/drm-sync-close branch from f2a3bc7 to e013cfd Compare May 12, 2026 16:11
@Drakulix
Copy link
Copy Markdown
Member Author

@ids1024 Ended up adding a Guard to make it less easy to break the api.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants